<?php

namespace Modules\Admin\Http\Controllers\District;

use Modules\Common\Models\District;
use Modules\Common\Util\Api;
use Modules\Common\Util\Database;


class Retrieve
{
    /**
     * @Route(path=/api/admin/district)
     */
    public function retrieve()
    {
        Api::validate(['district_id' => 'nullable|integer']);
        $data = District::whereParentId(request('district_id',Database::INT_DEFAULT))->get(['id', 'name']);
        return Api::success($data);
    }
}

